#!/user/bin/env python3
# -*- coding: utf-8 -*-
# author:YaFans


import re

with open('sample.txt') as f:
    read_result = f.read()



result = [ i.lower() for i in re.split(r"[._/$,:~()\n;' ]",read_result) if i.strip() != '' ]

result = {k:result.count(k) for k in result}

result = sorted(result.items(),key= lambda x:x[1],reverse=True)
for key,count in result[:10]:
    print('{},{}'.format(key,count))



# 如果文件很大的话，会占用很大的空间，可以优化一下
